package kr.bos;

import kr.bos.Framework.BaseLifecycle;
import kr.bos.Framework.Logger;
import android.content.Intent;
import android.content.ReceiverCallNotAllowedException;
import android.content.pm.ActivityInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ServiceInfo;
import android.os.Bundle;
import android.os.Handler;

/**
 * 인트로 화면
 * @author baek - bispro@uracle.co.kr
 * @date 2011. 12. 29.
 */
public class Intro extends BaseLifecycle {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.intro);

		displayResources();

		//0.5sec동안 인트로화면 보여주고 넘어감
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				Intent itt = new Intent(getApplicationContext(), Main.class);
				startActivity(itt);
				overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
				finish();
			}
		}, 500);
	}

	private void displayResources() {
		try {
			PackageInfo manager = getPackageManager().getPackageInfo(getPackageName(),
					PackageManager.GET_ACTIVITIES|
					PackageManager.GET_GIDS|
					PackageManager.GET_CONFIGURATIONS|
					PackageManager.GET_INSTRUMENTATION|
					PackageManager.GET_PERMISSIONS|
					PackageManager.GET_PROVIDERS|
					PackageManager.GET_RECEIVERS|
					PackageManager.GET_SERVICES|
					PackageManager.GET_SIGNATURES|
					PackageManager.GET_UNINSTALLED_PACKAGES );
			
			Logger.e("package  "+manager.packageName);
			Logger.e("verCode "+manager.versionCode);
			Logger.e("verName "+manager.versionName);
			
			ActivityInfo[] actInfo = manager.activities;
			ServiceInfo[] svsInfo = manager.services;
			ProviderInfo[] prvInfo = manager.providers;
			PermissionInfo[] perInfo = manager.permissions;
			for(int i = 0 ; actInfo!=null && i < actInfo.length ; i++) {
				Logger.v("ACTIVITY NAM["+actInfo[i].name+"]");
			}
			for(int i = 0 ; svsInfo!=null && i < svsInfo.length ; i++) {
				Logger.d("SERVICE NAM["+svsInfo[i].name+"]");
			}
			for(int i = 0 ; prvInfo!=null && i < prvInfo.length ; i++) {
				Logger.i("PROVIDER NAM["+prvInfo[i].name+"]");
			}
			for(int i = 0 ; perInfo!=null && i < perInfo.length ; i++) {
				Logger.w("PERMISSION NAM["+perInfo[i].name+"]");
			}
			
			String version = android.os.Build.VERSION.RELEASE;
			int sdkint = android.os.Build.VERSION.SDK_INT;
			int vercode = android.os.Build.VERSION_CODES.FROYO;
			Logger.e("VER : "+version + "VER COD : "+sdkint);
			
		} catch (Exception e) {
			e.printStackTrace();
		}		
	}
}